<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Controlla Json</title>

</head>
<body>
<jsp:useBean id="utente" scope="session" class="GestioneLogin.Utente" />
<jsp:useBean id="database" scope="page" class="GestioneDB.ConnessioneDB" />
	<%
		String email=request.getParameter("mail");
		String password=request.getParameter("pass");
		database.StartConnection();
		ResultSet Controllo=database.ResultQuery("SELECT email FROM utenti WHERE password='"+password+"' AND email='"+email+"'");
		if(!Controllo.isBeforeFirst())		
			out.println("Email o password sbagliata!");
		else{
			Controllo=database.ResultQuery("SELECT nome FROM utenti WHERE email='"+email+"'");
			while(Controllo.next())
				out.println("Benvenuto "+Controllo.getString("nome"));
		}
		database.Close();
		utente.setMail(email);
		utente.setPassword(password);		
	%>
</body>
</html>